$(document).ready(function() {
	$("#xpuser").focus();
	$("#submit").click(function() {
		// jQuery.getJSON("SYS/loginHome.action",{xpuser:$("#xpuser").attr("value"),xppasswd:$("#xppasswd").attr("value")});
			var username = $("#xpuser").attr("value");
			var password = $("#xppasswd").attr("value");
			if (username == "") {
				alert("请输入用户名");
			} else if (password == "") {
				alert("请输入密码");
			} else {
				AuthServices.validateLogin(username, password, {
					callback : function(result) {
						loginBack(result);
					},
					async : true
				});
			}
		});
	$("#reset").click(function() {
		$("#xpuser").attr("value", "");
		$("#xppasswd").attr("value", "");
	});
});
function loginBack(result) {
	result = eval(result);
	if (result.loginCode == '0') {
		window.open('SYS/loginInfoAction.action', '_self');
	} else {
		alert(result.loginMsg);
	}
}